package zaphod.toy.gef.japanexample.editparts;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;

import zaphod.toy.gef.japanexample.model.HelloModel;


public class HelloEditPart extends AbstractGraphicalEditPart
{

    @Override
    protected IFigure createFigure()
    {
        Object model = getModel();
        if ( model == null )
            throw new RuntimeException( "Model is null." );

        if ( model instanceof HelloModel )
        {
            HelloModel newModel = (HelloModel)model;
            Label label = new Label();
            label.setText( newModel.getText() );
            return label;
        }

        throw new RuntimeException( "No corresspodning Model : "
                + model.getClass().getName() );
    }


    @Override
    protected void createEditPolicies()
    {
        // TODO Auto-generated method stub

    }

}
